
/**
 * 需要授权访问的路由
 */
const asyncRoutesChildren = [
  {
    path: '/',
    name: 'home',
    meta: {
      roles: ['stu'],
      title: '主页',
      icon: 'home',
      keepAlive: true
    },
    component: () => import('../views/userCenter/StuCenter')
  },
  {
    path: '/stuCenter',
    name: 'stuCenter', // 和组件里的name一样
    meta: {
      roles: ['stu'],
      title: '学生中心',
      itemLabel: '学生服务',
      icon: 'assignment_ind',
      keepAlive: true
    },
    // component: layout,
    component: () => import('../views/userCenter/StuCenter')
  },
  {
    path: '/modPwd',
    name: 'modPwd', // 和组件里的name一样
    meta: {
      roles: ['stu'],
      title: '修改密码',
      isHidden: true
    },
    // component: layout,
    component: () => import('../views/userCenter/modPwd')
  },
  {
    path: '/ClassAdminCenter',
    name: 'ClassAdminCenter', // 和组件里的name一样
    meta: {
      roles: ['class_admin'],
      title: '学生中心',
      itemLabel: '学生服务',
      icon: 'assignment_ind',
      keepAlive: true,
      isHidden: true
    },
    // component: layout,
    component: () => import('../views/menu1/ClassAdminCenter')
  },
  {
    path: '/stu-attendance-waring',
    name: 'StudentAttend',
    meta: {
      roles: ['stu'],
      title: '考勤记录查询',
      icon: 'notifications',
      isOpen: true,
      keepAlive: true
    },
    component: () => import('../views/menu1/StudentAttend')
  },

  {
    path: '/stu-score=waring',
    name: 'StudentScore',
    meta: {
      roles: ['stu'],
      title: '成绩预警查询',
      icon: 'info',
      keepAlive: true
    },
    component: () => import('../views/menu2/StudentScore')
  },
  {
    path: '/',
    name: 'AdminAttend',
    meta: {
      roles: ['admin'],
      title: '考勤记录查询',
      itemLabel: '管理员服务',
      icon: 'notifications',
      isOpen: true,
      keepAlive: true
    },
    component: () => import('../views/menu1/AdminAttend')
  },
  {
    path: '/admin-score-waring',
    name: 'AdminScore',
    meta: {
      roles: ['admin'],
      title: '成绩预警查询',
      icon: 'info',
      keepAlive: true
    },
    component: () => import('../views/menu2/AdminScore')
  },

  {
    path: '/admin-score-record',
    name: 'admin-score-record',
    meta: {
      roles: ['admin'],
      title: '成绩录入',
      icon: 'edit_road',
      isHidden: true
    },
    component: () => import('../views/menu2/AdminScoreRecord')
  },
  {
    path: '/admin-score-change',
    name: 'AdminScoreChange',
    meta: {
      roles: ['admin'],
      title: '成绩修改',
      icon: 'book_online',
      keepAlive: true
    },
    component: () => import('../views/menu2/AdminScoreChange')
  },
  {
    path: '/class-admin-set',
    name: 'ClassAdminSet',
    meta: {
      roles: ['admin'],
      title: '设置班级管理员权限',
      icon: 'camera_front',
      keepAlive: true
    },
    component: () => import('../views/menu2/ClassAdminSet')
  },
  {
    path: '/failsExams',
    name: 'failsExams',
    meta: {
      roles: ['parent', 'stu', 'admin'],
      title: '详情',
      icon: 'notifications',
      isHidden: true
    },
    component: () => import('../views/menu2/failsExams')
  },
  {
    path: '/AdminFailExams',
    name: 'AdminFailExams',
    meta: {
      roles: ['admin'],
      title: '详情',
      icon: 'notifications',
      isHidden: true
    },
    component: () => import('../views/menu2/AdminFailExams')
  },
  {
    path: '/AdminAttendDetail',
    name: 'AdminAttendDetail',
    meta: {
      roles: ['admin'],
      title: '详情',
      icon: 'notifications',
      isHidden: true
    },
    component: () => import('../views/menu1/AdminAttendDetail')
  },
  {
    path: '/AttendDetail',
    name: 'AttendDetail',
    meta: {
      roles: ['parent', 'stu'],
      title: '详情',
      icon: 'notifications',
      isHidden: true
    },
    component: () => import('../views/menu2/StudentAttendDetail')
  },
  {
    path: '/',
    name: 'ParentAttend',
    meta: {
      roles: ['parent'],
      title: '考勤记录查询',
      itemLabel: '家长服务',
      icon: 'notifications',
      keepAlive: true
    },
    component: () => import('../views/menu1/ParentAttend')
  },
  {
    path: '/children-score-waring',
    name: 'ParentScore',
    meta: {
      roles: ['parent'],
      title: '成绩预警查询',
      icon: 'info',
      keepAlive: true
    },
    component: () => import('../views/menu2/ParentScore')
  },
  {
    path: '/',
    name: 'attendance-record',
    meta: {
      roles: ['class_admin'],
      title: '录入考勤信息',
      itemLabel: '班级管理员服务',
      icon: 'assignment'
    },
    component: () => import('../views/menu1/ClassAttend')
  },
  {
    path: '*', // 此处需置于最底部
    redirect: '/NoFound404',
    meta: {
      roles: ['admin', 'test'],
      isHidden: true
    }
  }
]

const asyncRoutes = [
  {
    path: '/',
    name: 'index',
    redirect: '/',
    component: () => import('../views/index'),
    children: asyncRoutesChildren
  }
]

export default asyncRoutes
